package net.itren.jetpackdemo.model

import android.util.Log
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel

class MainModel : ViewModel() {
    val contentTitle = MutableLiveData<String>()

    fun getMyString(): MutableLiveData<String> {
        return contentTitle
    }

    fun setMyString(string: String?) {
        this.contentTitle.setValue(string)
    }

    override fun onCleared() {
        super.onCleared()
        Log.e(this.javaClass.name, "viewModel 生命周期清除")
    }
}